Fix #4260 : Allow trailing arguments that accept void to be omitted #27522
Conversation
|
@typescript-bot test this |
|
Heya @RyanCavanaugh, I've started to run the extended test suite on this PR at 2b44a1b. You can monitor the build here. It should now contribute to this PR's status checks. |
|
@jack-williams FYI I expect the test run from the bot to fail so don't get worried if it comes back red |
|
No worries! Thanks for picking it up |
2b44a1b to
eae8ef1
Compare
eae8ef1 to
342fda9
Compare
|
This doesn't fix something like: declare function foo<T = void>(x: T);
foo(); // T = void, expected 1 arg, 0 givenwhich I actually think is one of the more useful scenarios. I disabled this behavior because otherwise it means you have to do arity checking again after instantiation which messes with overloading. I'm wondering if we could put in a special case for 1 signature? If it's seems useful enough that is. |
|
@jack-williams I don't find that example super compelling given that it potentially requires multiple iterations of reasoning, e.g. type MaybeVoid = T extends void ? void : object;
declare function foo<T = void>(x: T, y: MaybeVoid<T>);
foo(); |
|
@RyanCavanaugh Ye I’m inclined to agree. Thanks for merging! |
Since microsoft/TypeScript#27522 trailing void arguments may be omitted
|
Tags: void parameters void-typed parameters optional |
Fixes #4260